from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
import re
from selenium.webdriver.common.keys import Keys
from pyquery import PyQuery as pq
import time
driver=webdriver.Chrome()

url="https://www.toutiao.com/ch/movie/"

driver.get(url)
time.sleep(5)

with open(r'C:\website\toutiao\list2.txt','w') as f:
    while True:
        driver.execute_script('window.scrollTo(0,1000000)')
        titles=driver.find_elements_by_xpath("/html/body/div/div[4]/div[2]/div[2]/div/div/div/ul//li/div/div[1]/div/div[1]/a")
        for i in titles:
            f.write(i.get_attribute('href')+"\n")
            print(i.get_attribute('href'))
f.close